package com.ykqx.weather.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created with IntelliJ IDEA.
 * User: Legolas
 * Date: 2017/6/26 0026
 */
@Configuration
@ImportResource("classpath:spring-mybatis.xml")
@ComponentScan(basePackages = {"com.ykqx.weather.controller,com.ykqx.weather.app.controller"})
@EnableWebMvc
public class MvcConfig extends WebMvcConfigurerAdapter{
    /**
     * 定义静态资源访问路径
     * */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
       // registry.addResourceHandler("/static/**").addResourceLocations("/static/");
    }

    /**same as
     * <mvc:default-servlet-handler/>
     * */
    @Override
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
        configurer.enable();
    }




}
